﻿angular.module("umbraco").controller("Gary.WelcomeDashboardController", function ($scope, logResource, entityResource) {
    /**
     * 
     * var vm = this;
    vm.UserName = "guest";
    var limit = 100, start = 0;

    var isDebug = true;
    if (isDebug) {
        console.log("欢迎Dashboard启动……");
        console.log("日志资源服务启动：" + logResource);
        console.log("实例资源服务启动" + entityResource);
    }


    logResource.getUserLog("save", new Date()).then(function (logs) {
        if (isDebug) {
            console.log(logs);
        }
        var logEntries = [];
        angular.forEach(logs, function (log) {
            if (item.nodeId > 0) {
                if (item.comment.match("(\\bContent\\b|\\bMedia\\b)")) {
                    if (item.comment.indexOf("Media") > -1) {
                        item.entityType = "Media";
                        item.editUrl = "media/media/edit/" + item.nodeId;
                    }
                    if (item.comment.indexOf("Content") > -1) {
                        item.entityType = "Document";
                        item.editUrl = "content/content/edit/" + item.nodeId;
                    }
                    entityResource.getById(item.nodeId, item.entityType).then(function (ent) {
                        item.Content = ent;
                    });
                    if (start++ < limit + 1) {
                        logEntries.push(item);
                    }
                }
            }
        });
        vm.LogEntries = logEntries;
    });
     * */
    
});